if not ( RES_DISTRIB == 2 ) then Error("Please Install Resource Distribution 2 Addon.'" ) return end

TOOL.Category = '(Food Mod)'
TOOL.Name = '#Food Energy Sources'
TOOL.Command = nil
TOOL.ConfigName = ''
if (CLIENT and GetConVarNumber("RD_UseLSTab") == 1) then TOOL.Tab = "Life Support" end

TOOL.ClientConVar['type'] = 'beer_2_energy'
TOOL.ClientConVar['model'] = ''

cleanup.Register('foodenergy')

if ( CLIENT ) then
	language.Add( 'Tool_foodenergy_name', 'Food Energy Systems' )
	language.Add( 'Tool_foodenergy_desc', 'Create Energy System attached to any surface.' )
	language.Add( 'Tool_foodenergy_0', 'Left-Click: Spawn a Device.  Right-Click: Repair Device.' )

	language.Add( 'Undone_foodenergy', 'Energy System Undone' )
	language.Add( 'Cleanup_foodenergy', 'Food Energy Systems' )
	language.Add( 'Cleaned_foodenergy', 'Cleaned up all Energy Systems' )
	language.Add( 'SBoxLimit_foodmod', 'Maximum Food Generators Reached. Too Bad.' )
end

local foodenergy = {}
if (SERVER) then
	foodenergy.beer_2_energy = function( ply, ent, system_type, system_class, model )
		local maxhealth = 400
		local mass = 1000
		RD_AddResource(ent, "energy", 0)
		RD_AddResource(ent, "beer", 0)
		LS_RegisterEnt(ent, "Generator")
		return {}, maxhealth, mass
	end
end

local foodenergy_models = {
	{ 'Beer => Energy Converter', 'models/props_wasteland/coolingtank02.mdl', 'beer_2_energy' },
}

RD2_ToolRegister( TOOL, foodenergy_models, nil, "foodenergy", 30, foodenergy )
